package com.whutosa.template.server.service.impl;

import com.whutosa.template.server.dao.UserDao;
import com.whutosa.template.server.model.User;
import com.whutosa.template.server.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by 19110 on 2016/9/28.
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public User getUser(String uid) {
        return userDao.findOne(uid);
    }

    @Override
    public User login(String uid, String pswd) {
        User user = userDao.findOne(uid);
        if (user == null) {
            return null;
        }
        if (user.getPswd().equals(pswd)) {
            return user;
        } else {
            return null;
        }
    }
}
